function setAddressID(id){
	$("addsel").value=id;
}

function address_Selected(e)
{
	var ev = window.event|| e;
   	if(ev.keyCode==27)
	{
		openBg(0);
		openSelect(0,'selectAddress',null);
	}
	if( 13 == ev.keyCode )
	{
		transAddress();
	}
}

function showCity(cid,cname,ctype){
	$("divcity").innerHTML = "";
	getCity(cid,cname,ctype);

	if(ctype==0){
		var url = "getCity.aspx?cid=" + escape(cid);
		xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange = updateCityType;
		xmlHttp.send(null);
	}
}

function getCity(cid,cname,ctype){
	$("previewItem").innerHTML = "<label id='input'>"+ cname +"</label>";
	$("tmpjiguan").value=cid;
	if(ctype==1){
		transAddress();
	}
}

function transAddress(){
	openBg(0);
	openSelect(0,'selectAddress',null);
	copyAddress()	
}

function transAddress_1(){
	openBg(0);
	openSelect(0,'selectAddress',null);
	copyAddress_1("region");
}

function copyAddress(){
	var id1="previewItem";
	var mes = "";
	var items2 = $(id1).getElementsByTagName("label");
	for(var i = 0 ; i < items2.length ; i++)
	{
		if(items2[i].value!='')
		{
			mes=items2[i].innerHTML;
			break;		
		}
	}
	if($("addsel").value==1){
		$("cjobplace1").value=mes;
		$("jobplace1").value=$("tmpjiguan").value;
	}
	if($("addsel").value==2){
		$("cjobplace2").value=mes;
		$("jobplace2").value=$("tmpjiguan").value;
	}
}

function updateCityType() {
  	if (xmlHttp.readyState ==4) {
		$("divcity").innerHTML = xmlHttp.responseText;
  	}
}

function Job_Selected(e)
{
	var ev = window.event|| e;
   	if(27 == ev.keyCode)
	{
		openBg(0);
		openSelect(0,'selectJob',null);
	}
	if( 13 == ev.keyCode )
	{
		transJob();
	}
}

function getJob(jid,jname,jtype){
	$("previewItemJob").innerHTML = "<label id='input'>"+ jname+"</label>";
	$("tmpJob").value=jid;
	if(jtype==1){
		transJob();
	}
}

function showJob(jid,jname,jtype){	
	getJob(jid,jname,jtype);
	if(jtype==0){
		$("previewItemJob").innerHTML = "<label id='input'>"+ jname+"</label>";
		$("divFL").innerHTML = "[<label id='input1'>"+ jname+"</label>]";
		var url = "library/getJobType.asp?jid=" + escape(jid);
		xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange = updateJobType;
		xmlHttp.send(null);
	}
}

function updateJobType() {
	if (xmlHttp.readyState ==4) {
		$("divJob").innerHTML = xmlHttp.responseText;
  	}
}

function transJob(){
	openBg(0);
	openSelect(0,'selectJob',null);
	copyJob()	
}

function copyJob(){
	var id1="previewItemJob";
	var mes = "";
	var items2 = $(id1).getElementsByTagName("label");
	for(var i = 0 ; i < items2.length ; i++)
	{
		if(items2[i].value!='')
		{
			mes=items2[i].innerHTML;
			break;		
		}
	}
	if($("jobsel").value==1){
		$("jobtype_name").value=mes;
		$("jobtype").value=$("tmpJob").value;
	}
	if($("jobsel").value==2){
		$("jobtype_name2").value=mes;
		$("jobtype2").value=$("tmpJob").value;
	}
}

function setJobID(id){
	$("jobsel").value=id;
}

function refreshjob(var1){
	if(var1==1){
		$("divselected").innerHTML = "[<label id='input1'>"+ $("jobtype_name").value+"</label>]";
	}
	if(var1==2){
		$("divselected").innerHTML = "[<label id='input1'>"+ $("jobtype_name2").value+"</label>]";
	}
}

function reshowcity(city){
	$("previewItem").innerHTML = "<label id='input'>"+ city +"</label>";	
}